package com.cq.hd.order.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author mYunYu
 * @since 2023-12-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_order")
@ApiModel(value = "TbOrderPo对象", description = "订单表")
public class TbOrderPo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "商家id")
    @TableField("business_id")
    private Long businessId;

    @ApiModelProperty(value = "活动id")
    @TableField("active_id")
    private Long activeId;

    @ApiModelProperty(value = "一级经纪人id")
    @TableField("agent_id")
    private Long agentId;

    @ApiModelProperty(value = "二级经纪人id")
    @TableField("agent2_id")
    private Long agent2Id;

    @ApiModelProperty(value = "下单用户id")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "活动分享码")
    @TableField("active_share_code")
    private String activeShareCode;

    @ApiModelProperty(value = "订单号")
    @TableField("order_no")
    private String orderNo;

    @ApiModelProperty(value = "订单类型(1-团购订单,2-报名订单,4-团购+报名订单,5积分订单)")
    @TableField("order_type")
    private Integer orderType;

    @ApiModelProperty(value = "GROUP_BUY(拼团)")
    private String promotionType;

    @ApiModelProperty(value = "商家自有商户id")
    @TableField("merchant_id")
    private Long merchantId;

    @ApiModelProperty(value = "活动标题")
    @TableField("active_title")
    private String activeTitle;

    @ApiModelProperty(value = "活动图片")
    @TableField("active_img")
    private String activeImg;

    @ApiModelProperty(value = "活动开始时间")
    @TableField("start_time")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "活动结束时间")
    @TableField("end_time")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "活动有效开始时间")
    @TableField("valid_start_time")
    private LocalDateTime validStartTime;

    @ApiModelProperty(value = "活动有效结束时间")
    @TableField("valid_end_time")
    private LocalDateTime validEndTime;

    @ApiModelProperty(value = "补贴类型(0-未设置,1-自动按比例分摊,2-手动设置)")
    @TableField("subsidy_state")
    private Integer subsidyState;

    @ApiModelProperty(value = "多件多折状态(1-关闭，2-开启)")
    @TableField("discount_state")
    private Integer discountState;

    @ApiModelProperty(value = "是否是阶梯价格(1-否，2-是)")
    @TableField("step_price_state")
    private Integer stepPriceState;

    @ApiModelProperty(value = "分销开启状态(1-关闭，2-开启)")
    @TableField("agent_state")
    private Integer agentState;

    @ApiModelProperty(value = "核销方式(1-线上核销，2-线下核销)")
    @TableField("verify_method")
    private Integer verifyMethod;

    @ApiModelProperty(value = "未满员是否自动退款(报名订单):1-是，2-否")
    @TableField("no_full_auto_refund_state")
    private Integer noFullAutoRefundState;

    @ApiModelProperty(value = "活动总库存")
    @TableField("total_stock")
    private Integer totalStock;

    @ApiModelProperty(value = "订单状态(1-待支付,2-待核销,3-核销中,4-已取消,5-已完成,6-已关闭,7-已核销)")
    @TableField("order_state")
    private Integer orderState;

    @ApiModelProperty(value = "下单数量")
    @TableField("order_num")
    private Integer orderNum;

    @ApiModelProperty(value = "活动价格(如果是报名活动的阶梯价格，则是阶梯价格的最大价格)")
    @TableField("active_price")
    private BigDecimal activePrice;

    @ApiModelProperty(value = "订单总额")
    @TableField("order_price")
    private BigDecimal orderPrice;

    @ApiModelProperty(value = "实付金额/实付积分")
    @TableField("pay_price")
    private BigDecimal payPrice;

    @ApiModelProperty(value = "红包流水id")
    @TableField("red_packet_bill_id")
    private Long redPacketBillId;

    @ApiModelProperty(value = "红包金额")
    @TableField("red_packet_amt")
    private BigDecimal redPacketAmt;

    @ApiModelProperty(value = "优惠金额")
    @TableField("discount_amt")
    private BigDecimal discountAmt;

    @ApiModelProperty(value = "订单收入(当实付金额大于商品总额，订单收入=实付金额-商品总额)")
    @TableField("order_income_amt")
    private BigDecimal orderIncomeAmt;

    @ApiModelProperty(value = "固定佣金金额")
    @TableField("commission_amt")
    private BigDecimal commissionAmt;

    @ApiModelProperty(value = "固定佣金比例")
    @TableField("commission_rate")
    private BigDecimal commissionRate;

    @ApiModelProperty(value = "其他权益")
    @TableField("other_equity")
    private String otherEquity;

    @ApiModelProperty(value = "专属佣金比例(一级经纪人跟商家的佣金比例)")
    @TableField("exclusive_commission_rate")
    private BigDecimal exclusiveCommissionRate;

    @ApiModelProperty(value = "专属佣金比例(二级经纪人跟一级经纪人的佣金比例)")
    @TableField("sub_agent_commission_rate")
    private BigDecimal subAgentCommissionRate;

    @ApiModelProperty(value = "二级经纪人可得佣金")
    @TableField("sub_agent_commission_amt")
    private BigDecimal subAgentCommissionAmt;

    @ApiModelProperty(value = "计算佣金类型(0-无,1-固定佣金,2-专属佣金比例)")
    @TableField("cal_commission_type")
    private Integer calCommissionType;

    @ApiModelProperty(value = "实际全核销佣金金额")
    @TableField("actual_commission_amt")
    private BigDecimal actualCommissionAmt;

    @ApiModelProperty(value = "支付时间")
    @TableField("pay_time")
    private LocalDateTime payTime;

    @ApiModelProperty(value = "下单时间")
    @TableField("order_time")
    private LocalDateTime orderTime;

    @ApiModelProperty(value = "订单取消时间")
    @TableField("cancel_time")
    private LocalDateTime cancelTime;

    @ApiModelProperty(value = "订单取消原因")
    @TableField("cancel_reason")
    private String cancelReason;

    @ApiModelProperty(value = "订单核销完成时间")
    @TableField("verify_time")
    private LocalDateTime verifyTime;

    @ApiModelProperty(value = "订单完成时间")
    @TableField("finish_time")
    private LocalDateTime finishTime;

    @ApiModelProperty(value = "订单关闭时间")
    @TableField("close_time")
    private LocalDateTime closeTime;

    @ApiModelProperty(value = "订单备注")
    @TableField("order_note")
    private String orderNote;


    @ApiModelProperty(value = "预下单订单id")
    @TableField("pre_order_id")
    private String preOrderId;

    @ApiModelProperty(value = "请求日期")
    @TableField("hf_req_date")
    private String hfReqDate;

    @ApiModelProperty(value = "请求流水号")
    @TableField("hf_req_seq_id")
    private String hfReqSeqId;

    @ApiModelProperty(value = "创建者")
    @TableField("create_by")
    private Integer createBy;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新者")
    @TableField("update_by")
    private Integer updateBy;

    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "删除状态:0-正常，1-已删除")
    @TableField("del_state")
    private Integer delState;

    @ApiModelProperty(value = "是否是零元购活动（1-不是，2-是）")
    @TableField("zero_state")
    private Integer zeroState;

    @ApiModelProperty(value = "部分核销不退款（0-关闭 1-开启）")
    private Integer refundableExpiredUnused;

    @ApiModelProperty(value = "是否需要签到（0-否 1-是）")
    private Integer signInRequired;

    @ApiModelProperty(value = "返现金额")
    private BigDecimal returnAmt;

    @ApiModelProperty(value = "下单用户可得积分")
    @TableField("user_points_amt")
    private BigDecimal userPointsAmt;

    @ApiModelProperty(value = "一级经纪人可得积分")
    @TableField("agent_points_amt")
    private BigDecimal agentPointsAmt;

    @ApiModelProperty(value = "二级经纪人可得积分")
    @TableField("sub_agent_points_amt")
    private BigDecimal subAgentPointsAmt;

    private BigDecimal settledCommissionAmt;

    @ApiModelProperty(value = "下单用户积分结算状态：0无需结算 1待结算 2已结算")
    @TableField("user_points_settle_state")
    private Integer userPointsSettleState;

    @ApiModelProperty(value = "经纪人积分结算状态：0无需结算 1待结算 2已结算")
    @TableField("agent_points_settle_state")
    private Integer agentPointsSettleState;
}
